package com.potato.model1.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class HPageAdapter extends FragmentPagerAdapter {

    private List<String> mTitles;
    private List<Fragment> fragments;

    public HPageAdapter( List<String> mTitles,List<Fragment> fragments,@NonNull FragmentManager fm) {
        super(fm);
        this.mTitles=mTitles;
        this.fragments =fragments;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
